home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Source Code
/
Libraries
/
Dots & Pixels
/
headers
/
macutilities.h
< prev
next >
Wrap
C/C++ Source or Header
|
1995-09-29
|
3KB
|
90 lines
#pragma once
//
// set_settingsfile sets 'settingsfile' to the name of the settingsfile to use.
//
// If no files are dropped on the application the existence of the file named
// settingsfile is tested. If this fails a TEXT file of creator creator is made
// and TEXT resource 128 is written to the file.
//
// If one file is dropped on the application 'settingsfile' is set to the name
// of that file.
//
void set_settingsfile( char *settingsfile, const OSType creator);
//
// TwoBitColorMode returns the mode for which the given gDevice can be set in two-bit
// color mode with a color look-up table. If the device doesn't support such a mode
// zero is returned.
//
// GetIxDevice returns a GDHandle and a mode for the GDevice 'monitorno' in the
// device list, if a the GDevice supports _colors_ with a Color lookuptable at
// the bit depth specified.
//
int TwoBitColorMode( const GDHandle thedevice);
int GetIxDevice( const int monitorno, GDHandle &theGDevice, short &themode, short bitDepth = 2);
void load_clut( const int resno);
//
// The two 'realtime' functions use a system trap which is not (yet) officially
// supported by Apple. However:
//
// Newsgroups: comp.sys.mac.programmer
// Path: ruu.nl!news.nic.surfnet.nl!sun4nl!EU.net!uknet!pipex!howland.reston.ans.net!cs.utexas.edu!koriel!olivea!apple.com!gallant.apple.com!news
// From: Dave Falkenburg <falken@apple.com>
// Subject: Re: _MicroSeconds trap
// Sender: news@gallant.apple.com
// Message-ID: <1994Feb10.174754.25507@gallant.apple.com>
// X-Useragent: Version 1.1.3
// Date: Thu, 10 Feb 1994 17:47:54 GMT
// X-Xxdate: Thu, 10 Feb 94 17:47:48 GMT
// References: <1994Feb8.115024.25046@waikato.ac.nz>
// Organization: Apple Computer, Inc.
// Lines: 29
//
// In article <absurd-070294164939@17.202.12.60> Tim Dierks,
// absurd@apple.com writes:
// > While this may have leaked out in some sample code, let me publicly state
// > that this trap is not documented and may stop working at any moment. If
// > this isn't considered persuasive, please read the message I'm about to post
// > entitled "Undocumented System functionality and you".
// >
// > Tim Dierks
// absurd@apple.com
//
// Guess what Tim: it IS documented now.
//
// It has been moved into the public interfaces as part of the universal
// headers for PowerPC. Someone internally decided that since QuickTime has
// been beating the living crap out of this trap, it must be working. It
// also isn't that hard to implement in the future either.
//
// From the latest <Timer.h> in the Universal Headers:
//
// extern pascal void Microseconds(UnsignedWide *microTickCount)
// FOURWORDINLINE(0xA193, 0x225F, 0x22C8, 0x2280);
//
// The pain is that this trap returns a 64-bit value.
//
// -Dave Falkenburg
// -PowerPC System Software
// -Apple Computer, Inc.
//
#ifdef __CONDITIONALMACROS__
#include <Timer.h>
inline unsigned long readMicroseconds()
{
UnsignedWide a_wide;
Microseconds( &a_wide);
return a_wide.lo;
}
#else
pascal void readMicroseconds( unsigned long *twoLongs) =
{
0xA193, 0x225F, 0x22C8, 0x2280
};
inline unsigned long readMicroseconds()
{
unsigned long two_longs[ 2];
readMicroseconds( two_longs);
return two_longs[ 1];
}
#endif